package com.ymx.darling.generater.table;

import java.util.List;

/**
 * 表信息
 * @author 爱Java的小于
 */
public class Table {
    private String name;
    private final boolean idIsExist;
    private List<Column> columnList;

    public Table(String name, List<Column> columns) {
        this.name = name;
        this.columnList = columns;
        this.idIsExist = columns.stream().anyMatch(column -> column.getName().equals("id"));
    }

    public boolean isIdIsExist() {
        return idIsExist;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setColumnList(List<Column> columnList) {
        this.columnList = columnList;
    }

    public String getName() {
        return name;
    }

    public List<Column> getColumnList() {
        return columnList;
    }
}
